package com.peng._07springaop.aop;

import org.springframework.stereotype.Component;

/**
 * 计算器实现类
 * @Author peng
 * @Date 2024-04-28 17:41
 */
@Component
public class CalculatorImpl implements Calculator{
    @Override
    public int add(int a, int b) {
        return a+b;
    }

    @Override
    public int sub(int a, int b) {
        return a-b;
    }

    @Override
    public int mul(int a, int b) {
        return a*b;
    }

    @Override
    public int div(int a, int b) {
        if (b == 0){
            throw new RuntimeException("除数不能为0");
        }
        return a/b;
    }
}
